#ifndef __DOUBLELINKLIST_H_
#define __DOUBLELINKLIST_H_
#define ElementType void*

typedef struct DoubleLinkList DLlist;
int InitDLlist(DLlist *list);//初始化双链表
void InsertTail(DLlist *list,ElementType element);//尾差法
void TravelDLlist(DLlist *list,void(*func)(ElementType));//打印双链表
void InsertHead(DLlist *list,ElementType element);//头插法
void FreeDLlist(DLlist *list);//释放函数
void InsertIndex(DLlist *list,ElementType element,int index);//按位置插入
void RemoveByIndex(DLlist *list,int index);//按位置删除
int FindFirstElementIndex(DLlist *list,ElementType element);//寻找元素下标
void RemoveByElement(DLlist *list,ElementType element);//按元素删除
void SetByIndex(DLlist *list,ElementType element, int index);//按位置修改
void SetByElememt(DLlist*list,ElementType OldValue,ElementType NewValue);//按元素修改
struct Node * FindByIndex(DLlist *list,int index);//按位置查找
int *FindByElement(DLlist *list,ElementType element);//按元素查找

DLlist*FindIntersection(DLlist *list1,DLlist*list2);//找交集
void LinkListBubbleSort(DLlist *list);//冒泡法的双链表排序
int GetDLlistLen(DLlist *list);

struct Node 
{
    ElementType data;
    struct Node *next;
    struct Node *prev;
};


struct DoubleLinkList
{
    struct Node *head;
    struct Node *tail;
    int len;
};




#endif